const request = require('../../../utils/request.js')

Page({
  data:{ bindCode:'', parents:[], avatarFull:'' },
  onLoad(){ this.loadCode(); this.loadParents(); this.loadAvatar() },
  async loadCode(){
    try{ const res = await request.get('/mini/invite/bind-code'); if(res&&res.success){ this.setData({ bindCode: (res.data&&res.data.bindCode)||'' }) } }
    catch(e){ console.error('load bind code error:', e) }
  },
  async loadParents(){
    try{ const r = await request.get('/mini/parent/bind-list'); if(r&&r.success){ this.setData({ parents: r.data||[] }) } }
    catch(e){ console.error('load parents error:', e) }
  },
  loadAvatar(){ try{ const u=getApp().globalData.userInfo||{}; this.setData({ avatarFull: u.avatar||u.avatarFull||'' }) }catch(e){} }
})

